import React, {PropsWithChildren} from 'react'
import GoodsEditForm from "../components/GoodsEditForm";
import {addGoods} from "../apis/GoodsApi";
import {goodsPageStackStore} from "../store/GoodsPageStackStore";
import Scaffold from "../components/Scaffold";

export interface GoodsAddProps extends PropsWithChildren {

}

const GoodsAdd: React.FC<GoodsAddProps> = ({}) => {
    return <>
        <Scaffold title={"添加货品"}>
            {<GoodsEditForm onConfirm={async (value, _) => {
                await addGoods({
                    ...value,
                    subGoodsList: [],
                })
                goodsPageStackStore.resetListAndPageable()
            }}/>}
        </Scaffold>
    </>
}

export default GoodsAdd


